﻿@model Entity.Product_Comment
@{
    ViewBag.Title = "Create";
}
<h2>
    Create</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<form method="post" action="http://www.post2.com/home/create">
@Html.ValidationSummary(true)
<fieldset>
    <legend>Product_Comment</legend>
    <div class="editor-label">
        @Html.LabelFor(model => model.ProductID)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.ProductID)
        @Html.ValidationMessageFor(model => model.ProductID)
    </div>
    <div class="editor-label">
        @Html.LabelFor(model => model.UserID)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.UserID)
        @Html.ValidationMessageFor(model => model.UserID)
    </div>
    <div class="editor-label">
        @Html.LabelFor(model => model.CommentTitle)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.CommentTitle)
        @Html.ValidationMessageFor(model => model.CommentTitle)
    </div>
    <div class="editor-label">
        @Html.LabelFor(model => model.CommentInfo)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.CommentInfo)
        @Html.ValidationMessageFor(model => model.CommentInfo)
    </div>
    <p>
        <input type="button" value="Create" id="btnsubmit" />
    </p>
</fieldset>
</form>
<script type="text/javascript">
    $.ajax({
        type: "GET",
        dataType: "jsonp", 
        url: "http://www.post.com/Home/GetInfo",
        success: function (data) {
            alert(data);
        }
    })

    $("#btnsubmit").click(function () {
        alert("操作...");
        $.ajax({
            type: "POST",
            url: "http://www.post.com/home/create2",
            data: { commentTitle: $("#CommentTitle").val(), commentInfo: $("#CommentInfo").val() },
            success: function (data) {
                alert(data);
            }
        })
    });
</script>
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
